<html>
<head>
<%@include file="/WebPages/Includes/commonIncludes.jsp"%>

</head>
<body>
	<div class="col-md-6">
		<form id="userInsert">

			<div class="form-group">
				<label for="userInput">Code</label> <input type="text"
					class="form-control" name="aaCode" id="aaCode" />

			</div>
			<div class="form-group">
				<label for="userInput">aaPassword</label> <input type="text"
					class="form-control" name="aaPassword" id="aaPassword" />

			</div>
			<div class="form-group">
				<label for="userInput">aaLastPassword</label> <input type="text"
					class="form-control" name="aaLastPassword" id="aaLastPassword" />

			</div>
			<div class="form-group">
				<label for="userInput">aaSecurityQ1</label> <input type="text"
					class="form-control" name="aaSecurityQ1" id="aaSecurityQ1" />

			</div>
			<div class="form-group">
				<label for="userInput">aaSecurityA1</label> <input type="text"
					class="form-control" name="aaSecurityA1" id="aaSecurityA1" />

			</div>

			<div class="form-group">
				<label for="userInput">aaSecurityQ2</label> <input type="text"
					class="form-control" name="aaSecurityQ2" id="aaSecurityQ2" />

			</div>

			<div class="form-group">
				<label for="userInput">aaSecurityA2</label> <input type="text"
					class="form-control" name="aaSecurityA2" id="aaSecurityA2" />

			</div>
			<div class="form-group">
				<label for="userInput">aaMobileNumber</label> <input type="text"
					class="form-control" name="aaMobileNumber" id="aaMobileNumber" />

			</div>
			<div class="form-group">
				<label for="userInput">aaIsBlocked</label> <input type="text"
					class="form-control" name="aaIsBlocked" id="aaIsBlocked" />

			</div>
			<div class="form-group">
				<label for="userInput">aaPriviledgeLevel</label> <input type="text"
					class="form-control" name="aaPriviledgeLevel"
					id="aaPriviledgeLevel" />

			</div>
			<div class="form-group">
				<label for="userInput">createdBy</label> <input type="text"
					class="form-control" name="createdBy" id="createdBy" />

			</div>
			<div class="form-group">
				<label for="userInput">createdDate</label> <input type="text"
					class="form-control" name="createdDate" id="createdDate" />

			</div>
			<div class="form-group">
				<label for="userInput">modifiedBy</label> <input type="text"
					class="form-control" name="modifiedBy" id="modifiedBy" />

			</div>
			<div class="form-group">
				<label for="userInput">modifiedDate</label> <input type="text"
					class="form-control" name="modifiedDate" id="modifiedDate" />

			</div>

			<!-- 		Code <input name="aaCode" id="aaCode" type="text" /><br /> -->
			<!-- 		aaPassword <input name="aaPassword" type="text" /> <br /> -->
			<!-- 		aaLastPassword <input name="aaLastPassword" type="text" /> <br /> -->
			<!-- 		aaSecurityQ1 <input name="aaSecurityQ1" type="text" /> <br /> -->
			<!-- 		aaSecurityA1 <input name="aaSecurityA1" type="text" /> <br /> -->
			<!-- 		aaSecurityQ2 <input name="aaSecurityQ2" type="text" /> <br /> -->
			<!-- 		aaSecurityA2 <input name="aaSecurityA2" type="text" /> <br /> -->
			<!-- 		aaMobileNumber <input name="aaMobileNumber" type="text" /> <br /> -->
			<!-- 		aaIsBlocked <input name="aaIsBlocked" type="text" /> <br />  -->
			<!-- 		aaPriviledgeLevel <input name="aaPriviledgeLevel" type="text" /> <br />  -->
			<!-- 		createdBy <input name="createdBy" type="text" /> <br />  -->
			<!-- 		createdDate <input name="createdDate" type="text" /> <br /> -->
			<!-- 		modifiedBy <input name="modifiedBy" type="text" /> <br /> -->
			<!-- 		modifiedDate <input name="modifiedDate" type="text" /> <br /> -->
			<input type="button" value="Submit" class="btn btn-success"
				id="login" />
		</form>

	</div>
	<!-- 	private String aaCode; private String aaPassword; private String -->
	<!-- 	aaLastPassword; private String aaSecurityQ1; private String -->
	<!-- 	aaSecurityA1; private String aaSecurityQ2; private String aaSecurityA2; -->
	<!-- 	private String aaMobileNumber; private int aaIsBlocked; private int -->
	<!-- 	aaPriviledgeLevel; private String createdBy; private Date createdDate; -->
	<!-- 	private String modifiedBy; private Date modifiedDate; -->

</body>
<script>
	$(document)
			.ready(
					function() {
						$("#login")
								.click(
										function() {
											formData = ($('#userInsert')
													.serializeArray());
											alert(formData);
											$
													.ajax({
														url : 'http://localhost:8080/easyskool/rest/userauthservice/insertUser',
														type : 'POST',
														data : '{"user":"'
																+ $("#aaCode")
																		.val()
																+ '","fields":'
																+ converter(formData)
																+ '}',
														dataType : 'json',
														contentType : "application/json; charset=utf-8",
														success : function(
																data,
																testStatus,
																jqXHR) {
															alert(jqXHR.responseText);
															window.location = "./easyskool/WebPages/Admin/AdminHome.jsp";
														},
														error : function(data,
																testStatus,
																jqXHR) {
															alert("Error: ! "
																	+ jqXHR
																	+ data.responseText
																	+ " "
																	+ testStatus);
														}
													});
										});
					});
</script>

</html>